package service

import (
	"log"
	"os"

	"github.com/gofiber/fiber/v2"
	"github.com/gofiber/fiber/v2/middleware/favicon"
)

func embedStaticResource(app *fiber.App) {
	app.Static("/", "static")
	log.Println("set static dir:", "static")
}

func setFavicon(app *fiber.App) {
	const faviconPath = "static/image/favicon.ico"
	if _, err := os.Stat(faviconPath); err == nil {
		app.Get("/favicon.ico", favicon.New(favicon.Config{
			File: faviconPath,
		}))
	} else {
		log.Println("ignore favicon.ico")
	}
}
